package com.qzw.security.api.model;

import com.qzw.common.api.base.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @author ：quziwei
 * @date ：Created in 2020/6/2 11:59 上午
 * @description：
 */
@Data
public class Menu extends BaseModel<Integer> {

    private String name;
    private String description;
    @ApiModelProperty("前端路径")
    private String url;
    @ApiModelProperty("上级id")
    private Integer parentId;
    private Integer sort;
    private Byte status;
    @ApiModelProperty("资源类型,1-菜单,2-按钮,3-隐性权限")
    private Byte type;
    private Date createTime;

    @Override
    public int compareTo(Object obj) {
        Menu menu = (Menu) obj;
        int sort = getSort().compareTo(menu.getSort());
        sort = sort > 0 ? -1 : getId().compareTo(menu.getId());
        return sort;
    }
}
